package com.sun.dream.fish.vo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.dream.fish.frontmodel.resources.DSFErrorMessage;
import com.sun.dream.fish.session.DsfThreadLocalHelper;
import lombok.Data;

import java.io.Serializable;

/**
 * Description:  分页响应对象
 * Created By ljl on 2023/11/24.
 */

@Data
public class PageResultVO<T> implements Serializable {
    private int code;
    private String message;
    private Page<T> data;

    public PageResultVO() {
        this.code = 0;
        this.data = new Page<>();
        this.message = DSFErrorMessage.getInstance().getMessageByLocale(String.valueOf(code), DsfThreadLocalHelper.getDSFSession().getLocale());
    }

    public PageResultVO(int code, Page<T> data) {
        this.code = code;
        this.data = data;
        this.message = DSFErrorMessage.getInstance().getMessageByLocale(String.valueOf(code), DsfThreadLocalHelper.getDSFSession().getLocale());
    }

    public PageResultVO(int code, Page<T> data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }
}
